package com.workcell.workdata.im.repository.mapper;

import com.workcell.workdata.im.constant.Common;
import com.workcell.workdata.im.entity.Message;
import com.workcell.workdata.im.entity.SystemMessage;

public class SystemMessageMapper extends BaseMessageMapper<Message>{
    @Override
    public SystemMessage save(Message message) {
        SystemMessage systemMessage = new SystemMessage();
        super.copy(message,systemMessage);
        systemMessage.setUid(message.getReceiver());
        return systemMessage;
    }

    @Override
    public Message view(Message message) {
        SystemMessage source = (SystemMessage) message;
        SystemMessage systemMessage = new SystemMessage();
        super.copy(source,systemMessage);
        systemMessage.setReceiver(source.getUid());
        systemMessage.setSender(Common.SYSTEM_ID);
        return systemMessage;
    }
}
